<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // regular 规则
    // 包含张
    let reg = /张/;
    // 张字开头
    let reg2 = /^张/;
    // 张字结尾
    let reg3 = /张$/;
    // 张字重复出现3次
    let reg4 = /^张{3}$/;
    // 出现3次以上
    let reg5 = /^张{3,}$/;
    // 3-6 最少3次最多6
    let reg6 = /^张{3,6}$/;
    let str = "张张张张"
    // test 校验,测试
    console.log(reg.test(str))
    console.log(reg2.test(str))
    console.log(reg3.test(str))
    console.log(reg4.test(str))
    console.log(reg5.test(str))
    console.log("最少3次最多6",reg5.test(str))
  </script>
</body>
</html>